<template>


<div class="LeftNavWrapper" >
  

  <el-row class="tac">
    <el-col :span="24">
      <div class="left_title">{{realname}} - {{pos}}</div>
      <el-menu :default-active="left_select_index" class="el-menu-vertical-demo"  background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b">


        <!-- <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>服务信息</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="1-1" @click="linkTo('sev_lis')"></el-menu-item>
            <el-menu-item index="1-2">增加服务</el-menu-item>
          </el-menu-item-group>
        </el-submenu> -->
        <el-menu-item index="1"  @click="linkTo('sev_lis')" :disabled="!admin(pos)">
          <i class="el-icon-menu"></i>
          <span slot="title">服务列表</span>
        </el-menu-item>

        <el-menu-item index="2" @click="linkTo('trace')">
          <i class="el-icon-menu"></i>
          <span slot="title">信息追溯</span>
        </el-menu-item>
        <el-menu-item index="3" @click="linkTo('reg')" :disabled="admin(pos)">
          <i class="el-icon-menu" ></i>
          <span slot="title" >挂号预约</span>
        </el-menu-item>
        <el-menu-item index="13" :disabled="!doc(pos)" @click="linkTo('see_doctor')">
          <i class="el-icon-menu" ></i>
          <span slot="title">就诊服务</span>
        </el-menu-item>
        <el-menu-item index="4" :disabled="!admin(pos)" @click="linkTo('money')">
          <i class="el-icon-menu" ></i>
          <span slot="title">缴费管理</span>
        </el-menu-item>
        <el-menu-item index="5" :disabled="admin(pos)"  @click="linkTo('chat')">
          <i class="el-icon-menu"></i>
          <span slot="title">在线问诊</span>
        </el-menu-item>
        <!-- <el-menu-item index="6" disabled>
          <i class="el-icon-document"></i>
          <span slot="title">发送通知</span>
        </el-menu-item> -->
        <el-menu-item index="7" :disabled="!hushi(pos)" @click="linkTo('get_drug')">
          <i class="el-icon-document"></i>
          <span slot="title">取药管理</span>
        </el-menu-item>
        <el-menu-item index="8" @click="linkTo('feed_back')">
          <i class="el-icon-setting"></i>
          <span slot="title">反馈信息</span>
        </el-menu-item>
        <el-menu-item index="9" :disabled="!admin(pos)"  @click="linkTo('sys_info')">
          <i class="el-icon-setting"></i>
          <span slot="title">系统通知</span>
        </el-menu-item>
        <el-menu-item index="10" @click="linkTo('result_view')">
          <i class="el-icon-setting"></i>
          <span slot="title">结果维护</span>
        </el-menu-item>
      </el-menu>
    </el-col>
  </el-row>
</div>


</template>

<script>
export default {
  data(){
    return {
      left_select_index: window.localStorage.getItem('left_select_index'),
      abc: 'asd', 
      pos: window.localStorage.getItem("position"), 
      realname: window.localStorage.getItem("realname"), 
    }
  },

  methods: {
    linkTo(str){
      var nav_title_tmp = ''
      switch(str){
        case 'sev_lis': nav_title_tmp = '服务列表';break;
        case 'trace': nav_title_tmp = '信息追溯';break;
        case 'reg': nav_title_tmp = '挂号预约';break;
        case 'see_doctor': nav_title_tmp = '就诊服务';break;
        case 'money': nav_title_tmp = '缴费管理';break;
        case 'chat': nav_title_tmp = '在线问诊';break;
        case 'get_drug': nav_title_tmp = '取药管理';break;
        case 'feed_back': nav_title_tmp = '反馈信息';break;
        case 'sys_info': nav_title_tmp = '系统通知';break;
        case 'result_view': nav_title_tmp = '结果维护';break;
        default:  nav_title_tmp = '默认标题';
      }
      this.$store.commit("changeTitle", nav_title_tmp);
      this.$router.push({
        path: '/'+str
      })
    },
    admin(pos){
      if(pos == '管理员')return true;      
    }, 
    hushi(pos){
      if(pos == '护士')return true;
    }, 
    doc(pos){
      if(pos == '医生' || pos == '检验处')return true;
    }
  }
}
</script>



<style>
  .LeftNavWrapper .el-menu-item,.el-submenu__title{
    padding-left: 0px !important;
  }
  .LeftNavWrapper .el-menu-item-group .el-menu-item{
    padding-left: 45px !important;
  }
  .LeftNavWrapper .el-menu-item{
    min-width: auto;
  }
  .LeftNavWrapper .el-menu{
    border: solid 0;
  }
</style>

<style scoped>
.LeftNavWrapper .el-submenu .el-menu-item {
  min-width: 150px;
}

.left_title{
  background-color: rgb(84, 92, 100);
  margin: 0;
  padding: 20px;
  color:white;
  width: auto;
  border-right: 0px solid white;
}
.LeftNavWrapper{
  border: 0px solid green;
  min-width: 150px;
  position: relative;
  height: 100%;
}
</style>